-
Notifications
You must be signed in to change notification settings - Fork 3.3k
fix(providers): correct tool calling message format across all providers #3132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile OverviewGreptile SummaryCorrected tool calling message formats across multiple AI providers to align with their respective API specifications, particularly for handling parallel/multiple tool calls. Key Changes
The changes follow each provider's API requirements for tool calling and improve correctness when handling multiple parallel tool invocations. Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client
participant Provider
participant AI_API as AI API (Anthropic/Gemini/etc)
participant ToolExecutor
Client->>Provider: Send request with tools
Provider->>AI_API: Generate content
AI_API-->>Provider: Response with tool_use blocks
alt Multiple parallel tool calls
Note over Provider,ToolExecutor: NEW: Batch processing
loop For each tool_use
Provider->>ToolExecutor: Execute tool (parallel)
end
ToolExecutor-->>Provider: All results
Note over Provider: NEW: Single assistant message
Provider->>Provider: Batch all tool_use blocks
Note over Provider: NEW: Single user message
Provider->>Provider: Batch all tool_result blocks
Provider->>AI_API: Continue with batched messages
else Single tool call (legacy)
Provider->>ToolExecutor: Execute tool
ToolExecutor-->>Provider: Result
Provider->>AI_API: Continue with result
end
AI_API-->>Provider: Final response
Provider-->>Client: Complete response
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4 files reviewed, 2 comments
Additional Comments (1)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! Prompt To Fix With AIThis is a comment left during a code review.
Path: apps/sim/providers/gemini/core.ts
Line: 84:177
Comment:
Dead code - `executeToolCall` function is no longer called after introducing `executeToolCallsBatch`. Consider removing this function to reduce maintenance burden.
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise. |
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 files reviewed, no comments
|
@cursor review |
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4 files reviewed, no comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
Summary
Type of Change
Testing
Tested TypeScript compilation passes + added more tests
Checklist